// 市场销售 / 出院管理

import r from '@/utils/request'
import { type ListResponseType, type ResponseType } from '../types'

enum API {
    dischargeGet = 'discharge/get',// 获取单条出院信息
    dischargeList = "/discharge/list", // 出院列表
    dischargeAdd = "/discharge/add", // 出院添加
    dischargeUpdate = "/discharge/update", // 出院修改
    dischargeDelete = "/discharge/delete", // 出院删除
    dischargeDeleteAll = "/discharge/deleteAll" // 出院批量删除
}

export interface dischargeGetResAPI {
    id:             number;
    companyId:      number;
    elderlyId:      number;
    expectDate:     string;
    reason:         string;
    state:          number;
    addTime:        string;
    addAccountId:   number;
    begId:          number;
    begName:        string;
    addAccountName: string;
    elderlyName:    string;
    elderlyPhoto:   string;
    elderlyGender:  string;
    elderlyIdCard:  string;
    houseName:      string;
    buildingName:   string;
}

export function dischargeGetAPI(id:number):Promise<ResponseType<dischargeGetResAPI>> {
    return r.get( API.dischargeGet + '/' + id )
}

export interface dischargeListParams {
    page: number
    pageSize: number
    name: string
    idCard: string
    begId: string
    mobile: number
    state:number
}

export interface dischargeListResAPI {
    id:             number;
    companyId:      number;
    elderlyId:      number;
    expectDate:     string;
    reason:         string;
    state:          number;
    addTime:        string;
    addAccountId:   number;
    begId:          number;
    begName:        string;
    addAccountName: string;
    elderlyName:    string;
    elderlyPhoto:   string;
    elderlyGender:  string;
    elderlyIdCard:  string;
    houseName:      string;
    buildingName:   string;
}

export function getdischargeListAPI(Params:dischargeListParams):Promise<ListResponseType<dischargeListResAPI[]>> {
    return r.get(API.dischargeList,Params)
}

export interface  dischargeAddParams {
    elderlyId:  number;
    expectDate: string;
    reason:     string;
}

export interface dischargeAddResAPI {
    id:             number;
    companyId:      number;
    elderlyId:      number;
    expectDate:     string;
    reason:         string;
    state:          number;
    addTime:        string;
    addAccountId:   number;
    begId:          number;
    begName:        string;
    addAccountName: string;
    elderlyName:    string;
    elderlyPhoto:   string;
    elderlyGender:  string;
    elderlyIdCard:  string;
    houseName:      string;
    buildingName:   string;
}

export function dischargeAddAPI(Params:dischargeAddParams):Promise<ResponseType<dischargeAddResAPI>> {
    return r.post(API.dischargeAdd,Params)
}

export interface dischargeUpdateParams {
    id:         number;
    elderlyId:  number;
    expectDate: string;
    reason:     string;
}

export interface dischargeUpdateResAPI {
    id:             number;
    companyId:      number;
    elderlyId:      number;
    expectDate:     string;
    reason:         string;
    state:          number;
    addTime:        string;
    addAccountId:   number;
    begId:          number;
    begName:        string;
    addAccountName: string;
    elderlyName:    string;
    elderlyPhoto:   string;
    elderlyGender:  string;
    elderlyIdCard:  string;
    houseName:      string;
    buildingName:   string;
}

export function dischargeUpdateAPI(Params:dischargeUpdateParams):Promise<ResponseType<dischargeUpdateResAPI>> {
    return r.put(API.dischargeUpdate,Params)
}

export function dischargeDeleteAPI(id:number):Promise<ResponseType<null>> {
    return r.delete(API.dischargeDelete+'/'+id)
}

export function dischargeDeleteAllAPI(ids:number[]):Promise<ResponseType<null>> {
    return r.post(API.dischargeDeleteAll,ids)
}